package com.baylor.server.business.repository;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import com.baylor.server.business.entity.Customer;

@Repository
public interface CustomerRespository extends
    PagingAndSortingRepository<Customer, Long>,
    JpaSpecificationExecutor<Customer> {
    /**
     * @param loginAccount 登录账号
     * @return
     */
    @Query("from Customer csr where csr.loginAccount=?1")
    Customer findByLoginAccount(String loginAccount);

    /**
     *
     * @param loginAccount 登录账号
     * @param loginPwd 登录密码
     * @param value 标示符
     * @return
     */
    @Query("from Customer csr where csr.loginAccount=?1 and csr.loginPassword=?2 and cellPhone=?3")
    Customer customerLogin(String loginAccount,String loginPwd,String value);

    /**
     *
     * @param loginAccount 登录账号
     * @param loginPwd 登录密码
     * @return
     */
    @Query("from Customer csr where csr.loginAccount=?1 and csr.loginPassword=?2")
    Customer customerLogin(String loginAccount,String loginPwd);
}
